﻿using System;
using System.Collections.Specialized;
using System.IO;

namespace MiniAspNetCore
{
    /// <summary>
    /// 请求对象
    /// </summary>
    public class HttpRequest
    {
        private readonly IHttpRequestFeature _feature;

        public HttpRequest(IFeatureCollection feature) => _feature = feature.Get<IHttpRequestFeature>();

        /// <summary>
        /// 请求url
        /// </summary>
        public Uri Url => _feature.Url;

        /// <summary>
        /// 请求头
        /// </summary>
        public NameValueCollection Headers => _feature.Headers;

        /// <summary>
        /// 请求体
        /// </summary>
        public Stream Body => _feature.Body;
    }
}
